﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;

namespace CostaRicaPureTravel
{
    public partial class PureTravelMaster : System.Web.UI.MasterPage
    {
        protected void Page_Init(object sender, EventArgs e) { 
            
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void lanUs_Click(object sender, ImageClickEventArgs e)
        {
            changeLanguage("en-US");
        }

        protected void lanEs_Click(object sender, ImageClickEventArgs e)
        {
            changeLanguage("es-ES");
        }

        private void changeLanguage(string language) {
            System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo(language);
            System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo(language);
            HttpCookie cookie = new HttpCookie("CultureInfo");
            cookie.Value = language;
            Response.Cookies.Add(cookie);
            Response.Redirect(Request.Path);
        }
    }
}